http: optimize corked writes and header pair tracking - #64887
Closed
GetThatCookie wants to merge 2 commits into
Closed
http: optimize corked writes and header pair tracking#64887GetThatCookie wants to merge 2 commits into
GetThatCookie wants to merge 2 commits into
Conversation
Collaborator
|
Review requested:
|
ronag
approved these changes
Aug 1, 2026
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains two focused HTTP performance improvements without adding or
changing public APIs.
Optimize corked outgoing writes
OutgoingMessage.uncork()previously uncorked the underlying socket beforeflushing its buffered HTTP chunk. The individual framing writes therefore
bypassed socket-level batching.
Buffered body data could also be flushed after the terminating chunk when
end()was called while the message was still corked.This change:
drainlistener from writing after the terminatingchunk.
Cache
maxHeaderPairsThe HTTP parser previously read the JavaScript
maxHeaderPairsproperty forevery header field.
This change caches the value once per independent header section and
invalidates it for:
The parser benchmark now explicitly uses the production default of 2000 header
pairs because direct benchmark parsers bypass
cleanParser().Performance
Local macOS arm64 Release results, using the median of three short runs:
Parser benchmark improvements:
End-to-end HTTP header benchmarks improved by approximately 4.8% to 7.1%.
Tests
git diff --checkpassed.test-http-parser-*tests passed.test-http-outgoing-*tests passed.corking, callback ordering, trailers, backpressure, and queued pipelined
responses.
Documentation was not changed because no public API or documented behavior is
introduced.